package com.code.demo.service;

import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by yangliguo on 2019/3/2.
 */

public class MyIntentService extends IntentService {

    public MyIntentService() {
        super("MyIntentService");
        Log.e("TagMyIntentService", "construct");
    }

    @Override
    public void onDestroy() {
        Log.e("TagMyIntentService", "onDestroy");
        super.onDestroy();
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {

        try {
            int i = 0;
            do {
                Thread.sleep(2000);
                Log.e("TagMyIntentService", "onHandleIntent i = " + i++);
            } while (i<50);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
